using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

namespace CKS.EWE.Controls
{
   public class WikiTokenList : Control
{
       private string _show = "list";
       public string Show
       {
           get { return _show; }
           set { _show = value; }
       }


       protected override void Render(HtmlTextWriter output)
       {
           if (Show.ToLower() == "link")
           {
               output.Write("<span><a style='font-size:10px;' href='javascript:showHide(\"wikiMarkup\");'>Toggle Markup List</a></span>");
           }
           else
           {
               List<TokenUtils.WikiToken> WikiTokens = new List<TokenUtils.WikiToken>();
               WikiTokens.AddRange(TokenUtils.GetDefaultWikiTokens());
               output.Write(@"<div id='wikiMarkup' style='background-color:#FFFFFF; visibility:hidden; left:10px; 
                width:150px; top:192px; position:absolute; border: solid 1px #000000'><span style='font-size:12px; text-decoration:underline; 
                width:100%; text-align:center'>Supported Markup</span><span style='font-size:10px;'>");
               foreach (TokenUtils.WikiToken wt in WikiTokens)
               {
                   output.Write(wt.sDescription + "<br /><br />");
               }
               output.Write("<hr />");
               output.Write("{{TOC}} = Table of Contents <br /><br />");
               output.Write("[{Question for TOC}] <hr />");
               output.Write(@"{table}<br />||Col1 || Col2 || Col3<br />||AA || BB || CC<br />{table} <hr />");
               string sOnClick = "javascript:window.showModalDialog('/_layouts/CKSEWE/WikiMarkupList.aspx','dialogHeight=700,dialogWidth=600,status=no,toolbar=no,menubar=no,location=no,modal=yes,dialog=yes')";
               output.Write("<br /><br />Please see <a href='#' onclick=\"" + sOnClick + "\">");
               output.Write(" documentation</a> for more information<br /><br /></span></div>");
               output.Write(@"<script type='text/javascript'>var state = 'hidden';
                function showHide(layer_ref) {if (state == 'visible') {state = 'hidden';}else {state = 'visible';}
                objDiv = document.getElementById(layer_ref);objDiv.style.visibility = state;}</script>");
           }
       }

} 
}



